<!DOCTYPE html>
<html>
<body>
<h1>sessionStorage</h1>
<button onclick="saveData()">点我保存一个数据</button>
<button onclick="readData()">点我保存一个数据</button>
<button onclick="deleteData()">点我保存一个数据</button>
<button onclick="clearData()">点我保存一个数据</button>

<script>
    function saveData() {
        sessionStorage.setItem('name', '张三');
        sessionStorage.setItem('age', 18);
    }
    function readData() {
        console.log(sessionStorage.getItem('name'));
    }
    function deleteData() {
        sessionStorage.removeItem('name');
    }
    function clearData() {
        sessionStorage.clear();
    }
</script>

</body>
</html>